-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle error conditions better #135
Open
kost
wants to merge
1
commit into
iagox86:master
Choose a base branch
from
kost:robustness
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Display stack trace, but do not fail and exit (losing shells can be nightmare)
I totally agree. I've started re-writing the client in rust, with solid
error handling (and testing) built in. Unfortunately, it's a bit of a long
project.
…On Wed, Dec 5, 2018 at 6:35 AM kost ***@***.***> wrote:
Display stack trace, but do not fail and exit
(losing shells can be nightmare)
For example, dnscat2 server fails with following error messages on long
running servers:
Caught an error: DNS packet was truncated (or we messed up parsing it)!
/pentest/dnscat2/server/libs/dnser.rb:179:in unpack'
/pentest/dnscat2/server/libs/dnser.rb:634:in parse'
/pentest/dnscat2/server/libs/dnser.rb:849:in block (2 levels) in
on_request' /pentest/dnscat2/server/libs/dnser.rb:843:in loop'
/pentest/dnscat2/server/libs/dnser.rb:843:in `block in on_request'
Protocol exception caught in dnscat DNS module (for more information,
check window 'dns1'):
#<DnscatException: Received a packet with no questions>
Caught an error: undefined method serialize' for nil:NilClass
/pentest/dnscat2/server/libs/dnser.rb:678:in block in serialize'
/pentest/dnscat2/server/libs/dnser.rb:677:in each'
/pentest/dnscat2/server/libs/dnser.rb:677:in serialize'
/pentest/dnscat2/server/libs/dnser.rb:819:in reply!'
/pentest/dnscat2/server/libs/dnser.rb:775:in error!'
/pentest/dnscat2/server/tunnel_drivers/driver_dns.rb:357:in rescue in
block in initialize'
/pentest/dnscat2/server/tunnel_drivers/driver_dns.rb:293:in block in
initialize'
/pentest/dnscat2/server/libs/dnser.rb:879:in block (2 levels) in
on_request' /pentest/dnscat2/server/libs/dnser.rb:843:in loop'
/pentest/dnscat2/server/libs/dnser.rb:843:in block in on_request'
/pentest/dnscat2/server/libs/dnser.rb:883:in rescue in block (2 levels)
in on_request': undefined method response_template' for
#<DNSer::Transaction:0x0000000000dd6a58> (NoMethodError) Did you mean?
respond_to? from /pentest/dnscat2/server/libs/dnser.rb:878:in block (2
levels) in on_request'
from /pentest/dnscat2/server/libs/dnser.rb:843:in loop' from
/pentest/dnscat2/server/libs/dnser.rb:843:in block in on_request'
------------------------------
You can view, comment on, or merge this pull request online at:
#135
Commit Summary
- Handle error conditions better
File Changes
- *M* server/libs/dnser.rb
<https://github.com/iagox86/dnscat2/pull/135/files#diff-0> (13)
Patch Links:
- https://github.com/iagox86/dnscat2/pull/135.patch
- https://github.com/iagox86/dnscat2/pull/135.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#135>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAgITKdXlw5W9KYltpyVZbLbZPm8bYQeks5u19nCgaJpZM4ZC2uQ>
.
|
Regarding client in C, i have few patches to retry connection. They are bit hacky, but I will make pull request anyway, so feel free to decide what you want with it. |
Cool! I was thinking of forking them into new processes, so if the client
exits the main app would stick around. But that would require shared state,
which is kind of non-trivial, so I haven't done it.
…On Thu, Dec 6, 2018 at 7:27 AM kost ***@***.***> wrote:
Regarding client in C, i have few patches to retry connection. They are
bit hacky, but I will make pull request anyway, so feel free to decide what
you want with it.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#135 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAgITL_9jxaztF0zVnLhbu1JTsd2FYLGks5u2TdOgaJpZM4ZC2uQ>
.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Display stack trace, but do not fail and exit
(losing shells can be nightmare)
For example, dnscat2 server fails with following error messages on long running servers:
Caught an error: DNS packet was truncated (or we messed up parsing it)!
/pentest/dnscat2/server/libs/dnser.rb:179:in
unpack' /pentest/dnscat2/server/libs/dnser.rb:634:in
parse'/pentest/dnscat2/server/libs/dnser.rb:849:in
block (2 levels) in on_request' /pentest/dnscat2/server/libs/dnser.rb:843:in
loop'/pentest/dnscat2/server/libs/dnser.rb:843:in `block in on_request'
Protocol exception caught in dnscat DNS module (for more information, check window 'dns1'):
#<DnscatException: Received a packet with no questions>
Caught an error: undefined method
serialize' for nil:NilClass /pentest/dnscat2/server/libs/dnser.rb:678:in
block in serialize'/pentest/dnscat2/server/libs/dnser.rb:677:in
each' /pentest/dnscat2/server/libs/dnser.rb:677:in
serialize'/pentest/dnscat2/server/libs/dnser.rb:819:in
reply!' /pentest/dnscat2/server/libs/dnser.rb:775:in
error!'/pentest/dnscat2/server/tunnel_drivers/driver_dns.rb:357:in
rescue in block in initialize' /pentest/dnscat2/server/tunnel_drivers/driver_dns.rb:293:in
block in initialize'/pentest/dnscat2/server/libs/dnser.rb:879:in
block (2 levels) in on_request' /pentest/dnscat2/server/libs/dnser.rb:843:in
loop'/pentest/dnscat2/server/libs/dnser.rb:843:in
block in on_request' /pentest/dnscat2/server/libs/dnser.rb:883:in
rescue in block (2 levels) in on_request': undefined methodresponse_template' for #<DNSer::Transaction:0x0000000000dd6a58> (NoMethodError) Did you mean? respond_to? from /pentest/dnscat2/server/libs/dnser.rb:878:in
block (2 levels) in on_request'from /pentest/dnscat2/server/libs/dnser.rb:843:in
loop' from /pentest/dnscat2/server/libs/dnser.rb:843:in
block in on_request'